<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>顺风车---我的购物车</title>
<link href="${ctx}/css/panels.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/shop-css/common.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/shop-css/shoppingcart.css" />
</head>
<body>

<div id="myPin" style="display: none">liangThink</div>

<div class="Wrap_cart">

<div id="Top1_FeeInfo" class="mycart_tip">
	<img src="${ctx}/images/shop-img/cart_001.gif" />
</div>
	
<div id="Top1_order_step1" class="Header_cart" style="width:500px;">
<ul class="Order_cart" id="Order_cart_S1">
	<li class="step1">1.我的购物车</li>
	<li class="step2">2.填写核对订单信息</li>
	<li class="step3">3.成功提交订单</li>
</ul>
</div>

<!--促销-->
<div id="Promo_panel"></div>
<!--暂存降价-->
<div id="cartPromoPanel"></div>
<script type="text/javascript">//getCartPromo();</script>
<div id='stockErrorPanel'></div>

<div class="bluePanel">
<h3><a href="#" class="titleLink" title="购物车物品列表">我挑选的商品</a></h3>
<div class="box">

<div class="cart_table"><!--商品列表开始-->
<div id="productList">
<!--利用Ajax请求获得数据-->
</div>


<!--商品添加区开始-->
<div style="margin: 8px 0 0 0; display: none">
<table class='Table' cellpadding='0' cellspacing='0' width='100%'>
	<tr class='align_Center'>
		<td style="height: 27px; text-align: left; background: #EBF4FB none repeat scroll 0 0;">添加新商品：</td>
	</tr>
	<tr class='align_Center'>
		<td style="height: 27px; text-align: left">商品编号：<input
			type="text" id='addSkuId' style="width: 60px" /> 购买数量：<input
			type="text" id='addSkuNum' style="width: 30px" value="1" /> <input
			type="button" value="添加商品" onclick="AddProductOnEdit(this);"
			style="border: #AACDED 1px solid; background: #EBF4FB; font-size: 12px; height: 20px; padding-top: 2px; cursor: pointer" />
		</td>
	</tr>
</table>
</div>
<!--商品添加区结束-->


<!--购物车操作区开始-->
<ul class="cart_op" style="margin-bottom: 0px;">
 <!--<li class="li4"><a href="#none" onclick="this.blur();saveCart();">寄存购物车</a></li>-->
 <li class="li2"><a href="#none" onclick="this.blur();clearCart();">清空购物车</a></li>
 <!--<li class="li1"><a href="#" target="_blank">凑单商品</a></li>-->
 <li class="li3">
	<div id="submit_info"></div>
	<div id="submit_btn" style="text-align: right">
	<a href="shopping-cart!out.action">
	<img src="${ctx}/images/shop-img/jiesuan.jpg" 
	     id='gotoOrderInfo' onclick="return runOrderInfo();"
         style="cursor: pointer; border: none;" alt="进入订单信息页" />
    </a>
    </div>
	<div style="padding-right: 9px; text-align: right; border: #fff 1px solid;"
		id="submit_error">
	</div>
 </li>
</ul>
<!--购物车操作区结束-->

<!--[if !IE]>删除区<![endif]-->
<div id="DeledSkuInfo" style="clear:both;">

</div>

</div><!--商品列表结束-->

</div>
</div><!--end of bluePanel-->

</div>

<div class="Wrap_cart" style=" margin-top: 10px;" id="collection">
	<div class="List_cart">
	<div class="bluePanel">
	  <h3>
		  <span class="float_Right"><a href="${ctx}/home/favorite-book.action" target="_blank">进入收藏夹&gt;&gt;</a></span>
		  <a href="#" class="titleLink" title="收藏品列表">我收藏的商品</a><span style="font-size: 12px">(现在就放入购物车吧！)</span>
	  </h3>
      <div class="box">
      	<div class="cart_table" id='favSkuInfo'>
      		<div class="Product_List_S3">正在读取您收藏夹中的商品信息，请稍等  。。。</div>
			<ul class="my_fav_list">
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg" /></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg" /></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg" /></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg" /></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg" /></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java Thinking in java Thinking in java Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<li>
					<div class="fav_pic"><a href="#" target="_blank"><img src="${ctx}/images/myhome-img/java.jpg"/></a></div>
					<div class="fav_name"><a href="#" target="_blank">Thinking in java</a></div>
					<div class="fav_price"><span class="del">￥108.00</span>　<span class="red">￥86.40</span></div>
					<div class="fav_button"><a href=""><img src="${ctx}/images/shop-img/addcart2.gif"/></a></div>
				</li>
				<div class="clear"></div>
			</ul>
		</div>
      </div>
    </div>
	</div>
</div>

<script type="text/javascript">
function setProductList(){
	var url= "${ctx}/shop/shopping-cart!list.action";
	$.post(url,function(data,status){
		    if(data==""){
			       alert("加载失败！");
		    }else{
				$("#productList").empty();
				$("#productList").html(data);
		    }
		   },'html');
};
function setDeleteList(){
	var url= "${ctx}/shop/shopping-cart!deleteList.action";
	$.post(url,function(data,status){
		    if(data==""){
			       alert("加载失败！");
		    }else{
				$("#DeledSkuInfo").empty();
				$("#DeledSkuInfo").html(data);
		    }
		   },'html');
}
$(document).ready(function(){
	setProductList();
	setDeleteList();
});

//清空购物车
function clearCart(){
	var url = "${ctx}/shop/shopping-cart!clear.action";
	$.post(url, function(data,status){
		setProductList();
		setDeleteList();
		},'html');
};

//删除购物车某一项
function deleteCart(productId){
	var url = "${ctx}/shop/shopping-cart!delete.action";
	$.post(url,{productId:productId},
		   function(data,status){
			setProductList();
			setDeleteList();
		   },'html');
};
//直接给某一项设置数量
function changeCount(productId,o){
	var quantity = $(o).val();
	var url = "${ctx}/shop/shopping-cart!set.action";
	$.post(url,{productId:productId,quantity:quantity},
		   function(data,status){
			setProductList();
			setDeleteList();
		   },'html');
};

//单位量的增加或者减少cart
function changeBar(action,productId){
	var url;
	if(action=="+"){
		url = "${ctx}/shop/shopping-cart!addOne.action";
	}
	if(action == "-"){
		url = "${ctx}/shop/shopping-cart!deleteOne.action";
	}
	$.post(url,{productId:productId},
		       function(data,status){
				setProductList();
				setDeleteList();
			   },'html'
		);		
};

//从删除列表中重新购买
function changeCart(productId){
	var url= "${ctx}/shop/shopping-cart!change.action";
	$.post(url,
		   {productId:productId},
	       function(data,status){
				setProductList();
				setDeleteList();
		   },'html'
	);
};

function runOrderInfo(){
	if($("#total_amount").val() == 0){
		alert("您没有购买一件物品");
		return false;
	}
}

</script>
</body>
</html>